<?php
require_once('../../conf/config.php.inc');
require_once(SYBMAS_LIB_PATH.'/liblogin.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/layout.php.inc');
require_once(SYBMAS_LIB_PATH.'/libsybmas.php.inc');
require_once(SYBMAS_LAYOUT_PATH.'/menu.php.inc');
require_once('libtablas.php.inc');
verificar_inicio_sesion();
?>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="<?php echo LAYOUT_URI?>/sybmasstyle.css">
<script src="<?php echo LAYOUT_URI?>/jquery-1.2.1.min.js" type="text/javascript"></script>
<script src="<?php echo LAYOUT_URI?>/menu-collapsed.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<?php echo LAYOUT_URI?>/style.css" />
<script src="<?php echo JAVASCRIPT_URI?>/tabs/tabs.js"
	type="text/javascript"></script>
<script type="text/javascript" src="<?php echo JAVASCRIPT_URI?>/commons.js"></script>
<title>.:: Sybmas - Cambiar Mi Password</title>
<!--[if lt IE 8]>
   <style type="text/css">
   li a {display:inline-block;}
   li a {display:block;}
   </style>
   <![endif]-->
</head>
<body>
<script src="<?php echo JAVASCRIPT_URI?>/tooltip/wz_tooltip.js"
	type="text/javascript"></script>
<center>
<div id="container">
<div id="header">
<div id=""><?php generar_header();?></div>
</div>
<div id="scene">
<div id="modulos">
<ul id="menu" style="width: 150px;">
<?php generar_menu();?>
</ul>
</div>

<div id="title">Cambiar Mi Password</div>
<div id="main">
<?php 
$passAct = $_POST['passActual'];
$passNuevo = $_POST['passNuevo'];
//$passlogin = $_POST['passlogin'];
?>
<?php
	$validacionPassword=$_SESSION['sybmas.user.password']==$passAct;
	
	
	
	if(!$validacionPassword){
		echo "<h1>Su password es incorrecto, favor de verificar</h1>";
	}else {
		$passAct=$passAct==''?'null':$passAct;
	
		$sybuser_connection=start_default_sybuser_connection();
		$query="sp_password $passAct,$passNuevo";//,$passlogin";
		
		sybase_set_message_handler("void_msg_handler",$sybuser_connection);
		$result=@sybase_query($query,$sybuser_connection);
		//echo $query;
		sybase_set_message_handler("msg_handler",$sybuser_connection);
		if($result && $validacionPassword){
			echo "<h1>El password fue modificado exitosamente</h1>";
			echo "<h4>".sybase_get_last_message()."</h4>";
			$_SESSION['sybmas.user.password']=$passNuevo;
		}else{
			echo "<h1>Error al modificar el Password</h1>";
			echo "<h4>".sybase_get_last_message()."</h4>";
		}
		//Cerrando conexiones a la base de datos
		sybase_close($sybuser_connection);
	}
	
//}//if($cambio_bd_exitoso)


?>	
<input type="button" value="Aceptar" onclick="window.open('<?php echo CONTEXT_NAME	?>','_SELF');">	
</div>
</div>
<?php generar_footer();?></div>
</center>
</body>
</html>



